<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <title></title>
    <link rel="stylesheet" href="/js/layui/css/layui.css" media="all">
    <script src="/js/layui/layui.js"></script>
    <link rel="stylesheet" href="/css/common.css" media="all">
    <!--<script src="/admin/js/token.js"></script>-->
</head>
<body>
<style>
    .layui-laydate-main {
        width: 230px;
        height: 250px;
    }

     .layui-laydate-content td, .layui-laydate-content th {
        width: 15px;
        height: 15px;
    }
</style>
<div class="layui-fluid">
    <div class="layui-card">
        <div class="layui-form" style="padding: 10px 0px 30px 0px">
            <div class="layui-form-item">
                <label class="layui-form-label">结束时间</label>
                <div class="layui-input-inline">
                    <input type="text" class="layui-input" id="end" style="">
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-input-block">
                    <button class="layui-btn" type="button" id="confirm">确定</button>
                </div>
            </div>
        </div>
    </div>
</div>
</body>
<script type="text/javascript">
    layui.use(['laydate', 'form'], function () {
        var $ = layui.$;
        var form = layui.form;
        var laydate = layui.laydate;
        var data = layui.data("terminal");
        var terminalid = layui.data("terminalid").terminalid
        var terminalkeyid = data.getdata.terminal_key_id;
        laydate.render({
            elem: "#end",
            type: "datetime",
        })
        $("#confirm").click(function () {
            $.ajax({
                type: "post",
                url: "/admin/terminal/TerminalByIdUpdateTermainal_keyByIdupdate",
                data: {
                    terminalId: terminalid,
                    terminalKeyId: terminalkeyid,
                    TerminalKeyEndTime:$("#end").val()
                },
                success: function (res) {
                    switch (res.code) {
                        case 3:
                            layer.msg(res.data, {
                                icon: 2
                            })
                            break;
                        case 2:
                            layer.msg(res.data, {
                                icon: 2
                            })
                            break;
                        case 0:
                            layer.msg(res.data, {
                                icon: 1
                            })
                            setTimeout(function () {
                                var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
                                parent.layer.close(index);    //关闭弹出层
                            }, 2000)
                            break;
                    }
                }
            })
        })
    })
</script>
</html>